﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Barry.BarbeSystem.Models;
using NHibernate;
using NHibernate.Linq;
namespace Barry.BarbeSystem.Business
{
    public class EmployeeRepository : Repository<Employee>
    {
        public bool CanLogin(LoginModel model)
        {
            ISession session = NHibernateHelper.OpenSession();
           var array = session.Query<Employee>().ToList();
            var result = from item in session.Query<Employee>()
                         where item.Name == model.UserName && item.Pwd == model.Password
                         select item;
            if (result.Count() > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}